package com.sinodata.bsm.common.vo;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * ResViewRel entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "RES_VIEW_REL")
public class ResViewRel implements java.io.Serializable, Comparable {

    /**
     * 
     */
    private static final long serialVersionUID = -6259161575144205591L;

    // Fields
    private Long id;
    private Long resViewId;
    private Long resId;

    // Constructors

    /** default constructor */
    public ResViewRel() {
    }

    /** minimal constructor */
    public ResViewRel(Long id) {
        this.id = id;
    }

    /** full constructor */
    public ResViewRel(Long id, Long resViewId, Long resId) {
        this.id = id;
        this.resViewId = resViewId;
        this.resId = resId;
    }

    // Property accessors
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequence")
    @SequenceGenerator(name = "sequence", sequenceName = "RES_VIEW_REL_SEQ")
    @Column(name = "ID", unique = true, nullable = false, precision = 22, scale = 0)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "RES_VIEW_ID", precision = 22, scale = 0)
    public Long getResViewId() {
        return this.resViewId;
    }

    public void setResViewId(Long resViewId) {
        this.resViewId = resViewId;
    }

    @Column(name = "RES_ID", precision = 22, scale = 0)
    public Long getResId() {
        return this.resId;
    }

    public void setResId(Long resId) {
        this.resId = resId;
    }

    @Override
    public String toString() {
        return "ResViewRel [id=" + id + ", resViewId=" + resViewId + ", resId=" + resId + "]";
    }

    @Override
    public int compareTo(Object o) {
        ResViewRel another = (ResViewRel) o;
        long l = this.id.longValue() - another.id.longValue();
        return l > 0 ? 1 : (l == 0 ? 0 : -1);
    }

}